<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>签到页面</title>
    <link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css"/>
    <link rel="stylesheet" type="text/css" href="/layui/css/layui.css"/>
</head>
<body>
<div class="larry-personal-body clearfix">
    <form class="layui-form" lay-filter="example">

        <div class="layui-form-item">
            <label class="layui-form-label">姓名</label>
            <div class="layui-input-inline">
                <input type="text" id="name" name="contact" placeholder="请输入姓名" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="submit" id="sign" class="layui-btn" lay-submit="" lay-filter="addClientSub">签到</button>

                <a href="/car" class="layui-btn">返回</a>
            </div>
        </div>

    </form>
</div>

<script src="/js/jquery.min.js"></script>
<script src="/js/bootstrap.min.js"></script>

<script src="/layui/layui.js"></script>
<script src="/layui/layui.all.js"></script>

<script type="text/javascript">

    $(function () {
        $("body").on("click","#sign",function(){

            $.ajax({
                type:"get",
                url:"/sign",
                data:{"name":$("#name").val()},
                success:function(data){
                    console.log(data);
                    if(data=="ok"){
                        alert("签到成功，返回签到页面")
                        //刷新当前页面
                        window.location = "/test";
                    }else {
                        alert("签到失败，请重新签到")
                    }
                }
            });
        })
    })

</script>

</body>

</html>